package com.spera.genutil;

import java.util.Date;

import com.spring.security.web.dao.JedisCache;

public class MemberCardZxing {
	public static String MEMBERCARD_NUM = "membercard_num";
	public static String CREATETIME = "createTime";
	
	public static String SetSperaToken(JedisCache jedisCache,String membercard_num){
		String uuid = "";
		long n = 0;
		while(n==0){
			uuid = new Date().getTime()+""+(10+(int)(Math.random()*90));
			n = jedisCache.setnx(uuid, membercard_num);
		}
		jedisCache.expire(uuid, 300);
		return uuid;
	}
	
	public static String SetSperaToken(JedisCache jedisCache,Integer sec,String membercard_num){
		String uuid = "";
		long n = 0;
		while(n==0){
			uuid = new Date().getTime()+""+(10+(int)(Math.random()*90));
			n = jedisCache.setnx(uuid, membercard_num);
		}
		jedisCache.expire(uuid, sec);
		return uuid;
	}
}
